package StrategyMode.version5;

import java.util.Scanner;

/**
 * Created by ycq on 2018/10/17.
 * 打折收费类，继承现金收取超类
 */
public class CashRebate extends CashSuper {
    private String moneyRebate;
    /**
     * 现金收取超类的抽象方法，收取现金，参数为原价，返回为当前价
     * 打折收费
     * @param money
     * @return
     */
    @Override
    public double acceptCash(Double money) {
        return money*Double.parseDouble(moneyRebate);
    }

    /**
     * 构造器，初始化时输入折扣率
     * @param
     */
    public CashRebate(){
        Scanner in=new Scanner(System.in);
        System.out.println("输入折扣率");
        this.moneyRebate=in.next();

    }
}
